home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / graphic / pcx_c.zip / VGR.H < prev    next >
Text File  |  1988-04-17  |  4KB  |  115 lines

  1. /*    VGR.h    -  Header for VGR.c and board specific graphic modules
  2.  
  3.     *******************************************************
  4.     * It's a good idea to assume that the video/graphics  *
  5.     * functions   WON'T WORK IN THE SMALL DATA MODELS!    *
  6.     *******************************************************
  7. */
  8.  
  9. typedef struct {
  10.    unsigned int ax, bx, cx, dx, si, di, ds, es;
  11. } REGS;
  12.  
  13. /*    Card specific constants
  14. */
  15.  
  16. #define BASE_MDA    0xb8000000l
  17. #define BASE_EGA    0xa0000000l
  18. #define BASE_CGA    0xb8000000l
  19. #define BASE_HERC0  0xb0000000l /* page 0 */
  20. #define BASE_HERC1  0xb8000000l /* page 1 */
  21.  
  22. #define TYPE_UNKNOWN   0
  23. #define TYPE_MDA    1
  24. #define TYPE_EGA    2
  25. #define TYPE_CGA    3
  26. #define TYPE_HERC   4
  27.  
  28.  
  29. /*    Each video board, and each mode that is supported, will have 
  30.     it's own set of driver functions. These functions will be
  31.     placed into a module of their own. This module, on 
  32.     initialization, will describe to the general routines the
  33.     characteristics of the specific board/mode being driven.
  34.  
  35.     The functions in each module will be called in exactly the 
  36.     same way for each board/mode.
  37.  
  38.     The current function list will be in this order:
  39.  
  40.     INIT     Init the module. NOTE: Don't use this macro until
  41.              after one of the driver level *_init() routines
  42.              has been called!
  43.     MODE     Select a TEXT or APA mode.
  44.     CLEAR    Clear the screen.
  45.     SET      Set a point (turn it on.)
  46.     CLR      Clear a point (turn it off.)
  47.     XOR      XOR a point (turn it off if we want it on and it's on,
  48.              or if it's off and we want it off. Turn it off if we
  49.              want it on and it's off, or if it's on and we want it
  50.              on.)
  51.     GET      Return the current color of the dot.
  52.     ROW      Write an entire ROW of dots.
  53.  
  54.     VPEEK    Same as MOVMEM, PEEK & POKE. HERC and EGA boards don't
  55.     VPOKE    need to test for flicker, but old CGA boards do. So...
  56.     VMOVE    These macros will point to either movmem(), peek() &
  57.              poke(), or cga_movmem(), cga_peek() & cga_poke(). The
  58.              calling module doesn't need to know which.
  59.  
  60.     The following functions are supported for the benefit of the
  61.     EGA board:
  62.  
  63.     PLANE    Select the desired bit map.
  64.     PALETTE  Set a palette register.
  65.  
  66.     The following function is provided for the benefit of the CGA
  67.     board:
  68.     
  69.     CPAL     set the palette for the CGA board.
  70.  
  71.     The following function is supported for the benefit of the
  72.     HERC board:
  73.  
  74.     PAGE     Select the page to draw/view.
  75. */
  76.  
  77. GLOBAL int (*vgr_func[14])();
  78.  
  79. GLOBAL int VGR_HRES,
  80.        VGR_VRES,
  81.        VGR_NCOLORS,
  82.        VGR_NBPL;
  83.  
  84. #define VGR_INIT()           ((*vgr_func[ 0])())
  85. #define VGR_CLEAR()          ((*vgr_func[ 1])())
  86. #define VGR_SET(x,y,c)       ((*vgr_func[ 2])((x),(y),(c)))
  87. #define VGR_CLR(x,y)         ((*vgr_func[ 3])((x),(y)))
  88. #define VGR_XOR(x,y,c)       ((*vgr_func[ 4])((x),(y),(c)))
  89. #define VGR_GET(x,y)         ((*vgr_func[ 5])((x),(y)))
  90. #define VGR_ROW(r,p,n)       ((*vgr_func[ 6])((r),(p),(n)))
  91. #define VGR_PLANE(p)         ((*vgr_func[ 7])((p)))
  92. #define VGR_PALETTE(p,r,g,b) ((*vgr_func[ 8])((p),(r),(g),(b)))
  93. #define VGR_MODE(n)          ((*vgr_func[ 9])((n)))
  94. #define VGR_MOVE(s,d,n)      ((*vgr_func[10])((s),(d),(n))
  95. #define VGR_PEEKB(p)         ((*vgr_func[11])((p))
  96. #define VGR_POKEB(p,b)       ((*vgr_func[12])((p),(b))
  97. #define VGR_PAGE(p)          ((*vgr_func[13])((p)))
  98. #define VGR_CPAL(p,r)        ((*vgr_func[14])((p),(r)))
  99.  
  100. #define MODE_TEXT0     1     /* text, 80x25                      */
  101. #define MODE_APA0      2     /* APA, 640x350x16                  */
  102. #define MODE_APA1      3     /* APA, 720x348x2                   */
  103. #define MODE_APA2      4     /* APA, 640x200x2                   */
  104. #define MODE_APA3      5     /* APA, 320x200x4                   */
  105.  
  106. /*    Misc. Stuff...
  107. */
  108.  
  109. #define CASTUCFPP (unsigned char far * far *)
  110. #define CASTUCFP (unsigned char far *)
  111.  
  112. void vgr_fill();
  113. void vgr_point();
  114.  
  115.